//author-szy 科室费用分析病例区间分布的病例数点击下的病例明细页面
$(function(){ 
	showCondition(true);//加载查询条件
	//获取前台传来的参数
	var param = drgUI.setAjaxData(tabId);
	var dateFrom=param.dateFrom; //开始日期
	var dateTo=param.dateTo;   	 //截止日期
	var hospCode=param.hospCode; //院区编码
	var monitorType=param.monitorType; //维度类型（科室/主诊组)
	var	dimensionCode=param.dimensionCode;   //维度代码
	var depCode=param.pardepCode; //科室编码
	var sliderValBenchLater =param.sliderValBenchLater; //超标系数值
	var compareType = param.compareType; //划分类型 1是标杆法区间划分 2是标差法区间划分
	var compareObj = param.compareObj;	//指标项(如平均住院日)
	var abnomalType = param.abnomalType;	//区间类型  全部病例 all 未超标 not 超标N以内病例 in 超标N及以上病例 more
	var pType=param.pType; //人员类型 0是全体 1是医保
	//往后台传递的参数拼接
	var paramPost={"dateFrom":dateFrom,"dateTo":dateTo,"hospCode":hospCode,"monitorType":monitorType,
			"dimensionCode":dimensionCode,"sliderValBenchLater":sliderValBenchLater,
			"compareType":compareType,"compareObj":compareObj,"abnomalType":abnomalType,"pType" :pType,
			"depCode":depCode
	};
	$.post(contextPath + "/feeAnalysisDep/loadFeeAnalysisCaseTable.dhc", param).done(function(data) {
		if(data||data.success){
			var data=data.data;
			var columns=[
			               	{"data": "MRNO","title":"病案号",
			               		"render": function(obj, type, full){
			    				 return "<a href=\"javascript:medicalRecord('"+full.PMAININDEX+"','"+full.NAME+"')\">"+full.MRNO+"</a>";
			    			   } 
			               	},
			               	{"data": "NAME","title":"姓名" },
			               	{"data": "GENDER","title":"性别",
			           			"render": function(obj, type, full) {
			           				if(full.GENDER=="1") {
			           					return "男";
			           				} else if(full.GENDER=="0"||full.GENDER=="2"){
			           					return "女" ;
			           				} else{
			           					return full.GENDER;
			           				}
			           			}	
			           		},
			               	{"data": "AGE","title":"年龄" },
			           		{"data": "INDATE","title":"入院时间"},
			           		{"data": "OUTDATE","title":"出院时间"},
			           		{"data": "OUTDEP","title":"出院科室"},
			           		{"data": "DR","title":"医师"},
			           		{"data": "DIAG","title":"主要诊断编码及描述"},
			           		{"data": "OPER","title":"主要手术/操作编码及描述"},
			           		{"data": "DRGS","title":"DRG代码及描述"},
			           		{"data": "COST","title":"住院费用(元)",
			           			"render": function(obj, type, full) {
			           				if (full.COST > full.COSTF){
			                            return '<span class="text-danger" title="超标">'+formatNumber(full.COST,2)+'</span>';
			                        } else {
			                            return '<span>'+formatNumber(full.COST,2)+'</span>';
			                        }
			           			}
			           		},
			           		{"data": "COSTF","title":"住院费用标杆(元)",
			           			"render": function(obj, type, full) {
			           				return formatNumber(full.COSTF,2) ;
			           			}
			           		},
			           		{"data": "INDAYS","title":"住院天数",
			           			"render": function(obj, type, full) {
			           				if (full.INDAYS > full.INDAYSF){
			                            return '<span class="text-danger" title="超标">'+full.INDAYS+'</span>';
			                        } else {
			                            return '<span>'+full.INDAYS+'</span>';
			                        }
			           			}
			           		},
			           		{"data": "INDAYSF","title":"住院日标杆"},
			           		{"data": "MED","title":"医疗费用(元)",
			           			"render": function(obj, type, full) {
			           				if (full.MED > full.MEDF){
			                            return '<span class="text-danger" title="超标">'+formatNumber(full.MED,2)+'</span>';
			                        } else {
			                            return '<span>'+formatNumber(full.MED,2)+'</span>';
			                        }
			           			}
			           		},
			           		{"data": "MEDF","title":"医疗费用标杆(元)",
			           			"render": function(obj, type, full) {
			           				return formatNumber(full.MEDF,2) ;
			           			}
			           		},
			           		{"data": "NURS","title":"护理费用(元)",
			           			"render": function(obj, type, full) {
			           				if (full.NURS > full.NURSF){
			                            return '<span class="text-danger" title="超标">'+formatNumber(full.NURS,2)+'</span>';
			                        } else {
			                            return '<span>'+formatNumber(full.NURS,2)+'</span>';
			                        }
			           			}
			           		},
			           		{"data": "NURSF","title":"护理费用标杆(元)",
			           			"render": function(obj, type, full) {
			           				return formatNumber(full.NURSF,2) ;
			           			}
			           		},
			           		{"data": "MANAGE","title":"管理费用(元)",
			           			"render": function(obj, type, full) {
			           				if (full.MANAGE > full.MANAGEF){
			                            return '<span class="text-danger" title="超标">'+formatNumber(full.MANAGE,2)+'</span>';
			                        } else {
			                            return '<span>'+formatNumber(full.MANAGE,2)+'</span>';
			                        }
			           			}
			           		},
			           		{"data": "MANAGEF","title":"管理费用标杆(元)",
			           			"render": function(obj, type, full) {
			           				return formatNumber(full.MANAGEF,2) ;
			           			}
			           		},
			           		{"data": "TECH","title":"医技费用(元)",
			           			"render": function(obj, type, full) {
			           				if (full.TECH > full.TECHF){
			                            return '<span class="text-danger" title="超标">'+formatNumber(full.TECH,2)+'</span>';
			                        } else {
			                            return '<span>'+formatNumber(full.TECH,2)+'</span>';
			                        }
			           			}
			           		},
			           		{"data": "TECHF","title":"医技费用标杆(元)",
			           			"render": function(obj, type, full) {
			           				return formatNumber(full.TECHF,2) ;
			           			}
			           		},
			           		{"data": "DRUG","title":"药品耗材费用(元)",
			           			"render": function(obj, type, full) {
			           				if (full.DRUG > full.DRUGF){
			                            return '<span class="text-danger" title="超标">'+formatNumber(full.DRUG,2)+'</span>';
			                        } else {
			                            return '<span>'+formatNumber(full.DRUG,2)+'</span>';
			                        }
			           			}
			           		},
			           		{"data": "DRUGF","title":"药品耗材费用标杆(元)",
			           			"render": function(obj, type, full) {
			           				return formatNumber(full.DRUGF,2) ;
			           			}
			           		}
		  ];
			var paramsDataTables={searching:true,ordering:true,stateSave:true,scrollX:true,tableTitle:'' ,columnDefs:[{"orderable": false,"targets": [ 0 ] }],fixedColumns:{'leftColumns' : 7}};
			//使表头只展示一行
			var dataTable= $("#"+tabId+" #feeAnalysisCaseTable").dataTableBasic(columns,data,paramsDataTables) ;
			
		}
	})
})
